<?php
/**
 * @CopyRight  (C)2006-2011 OE Development team Inc.
 * @WebSite    www.phpcoo.com，www.oecms.cn
 * @Author     XiangFeng <phpzac@foxmail.com>
 * @Brief      OEcms v3.x
 * @Update     2011.09.01
**/
session_start();
require_once '../source/core/run.php';
$action	= Core_Fun::rec_post("action",1);

if($action=="loginpost"){
	$username	= Core_Fun::rec_post("username",1);
	$password	= Core_Fun::rec_post("password",1);
	$checkcode	= Core_Fun::rec_post("checkcode",1);
	$founderr   = false;
	if(!Core_Fun::ischar($username)){
		$founderr	= true;
		$errmsg	   .= "管理员帐号不能为空.<br />";
	}else{
		if(!Core_Fun::check_userstr($username)){
			$founderr	= true;
			$errmsg	   .= "帐号格式不正确！.<br />";
		}
	}
	if(!Core_Fun::ischar($password)){
		$founderr	= true;
		$errmsg	   .= "密码不能为空.<br />";
	}
	if(!Core_Fun::ischar($checkcode)){
		$founderr	= true;
		$errmsg	   .= "验证码不能为空.<br />";
	}else{
		if($checkcode != $_SESSION["verifycode"]){
			$founderr	= true;
			$errmsg	   .= "验证码不正确.<br />";
		}
	}
	if($founderr == true){
		Core_Fun::halt($errmsg,"",1);
	}else{
		$libadmin->login($username,$password);
	}	
}else{
	$tpl->display(ADMIN_TEMPLATE."login.tpl");
}
?>